package com.shujia.util

import org.apache.spark.sql.{DataFrame, SparkSession}

abstract class SparkRunner {

  var fieldName: String = _

  def main(args: Array[String]): Unit = {
    if (args.isEmpty) {
      println("亲指定时间参数")
      return
    }
    //获取参数
    val ds: String = args.head

    //创建spark 环境
    val spark: SparkSession = SparkTool.getSparkSession

    //提取标签
    val userTag: DataFrame = fetchTgg(spark, ds)

    //保存到Hbase
    HBaseUtil.userTagToHBase(userTag, fieldName)
  }

  def fetchTgg(spark: SparkSession, ds: String): DataFrame
}
